package com.mewpipe.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mewpipe.dao.DaoFactory;

import com.mewpipe.dao.VideoDao;
import com.mewpipe.entity.Video;


@WebServlet("/Index")
public class IndexServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	private VideoDao videoDao;
	@Override
	public void init() throws ServletException {
		videoDao = DaoFactory.getInstance().getVideoDao();
	}
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 List<Video> listvideo = videoDao.getindexvideo();
		request.setAttribute("Listvideo",(List<Video>) listvideo);
		
		request.getRequestDispatcher("/index.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

}
